<template>
  <div class="app-container">





    <!--列表数据  -->
    <el-table :data="list" border fit highlight-current-row style="width: 100%;">
      <el-table-column label="姓名" prop="realName" align="center"/>

      <el-table-column label="图片" prop="imgUrl" align="center">
        <template scope="scope">
          <img :src="baseUrl+scope.row.certPicPath" width="60px" height="60px">
        </template>
        </el-table-column>
      <el-table-column label="手机号" prop="phone" align="center"/>
      <el-table-column label="微信号" prop="wxNumber" align="center"/>
      <el-table-column label="审核状态" prop="checkStatus" align="center">
        <template scope="scope">
          <el-tag :type="scope.row.checkStatus==0?'':'success'">{{scope.row.checkStatus==0?'待审核':'已通过'}}</el-tag>
        </template>
      </el-table-column>
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="285px">
        <template slot-scope="{row}">
          <el-button type="primary" size="mini" @click="engineerPass(row)">审核</el-button>

        </template>
      </el-table-column>
    </el-table>
    <!-- 底部分页 -->
    <pagination v-show="count > 0" align="center" :total="count" :page.sync="listQuery.page"
                :limit.sync="listQuery.size" @pagination="getList(listQuery.page,listQuery.size)"/>
  </div>
</template>
<script>
  // 后台接口数据
  import {getEnngineerList,engineerPass} from '@/api/enguneer'
  import Pagination from '@/components/Pagination'
  export default {
    name: 'generalList',
    components: {Pagination},
    data() {
      return {
        imageUrl: '',
        dialogStatu: '',
        dialogVisible:false,
        textMap: {
          update: '编辑',
          create: '添加'
        },
        temp:{
          title:'',
          details:''
        },
        listQuery:{
          page:1,
          size:10
        },
        baseUrl:process.env.VUE_APP_BASE_API+'/static/pic/show/',
        uploadBaseUrl:process.env.VUE_APP_BASE_API+'/static/pic/upload',
        count:0,
        list:[],
        image:'',
        editId:'',
        editImage:''
      }
    },

    created() {
      this.getList(1,10)
    },

    methods: {

      engineerPass(row){
        engineerPass(row.id).then(res =>{
          this.$notify({
            title: 'Success',
            message: '操作成功',
            type: 'success',
            duration: 2000
          })
          this.getList(1,10)
        })
      },

      handleAvatarSuccess(res, file) {
        this.imageUrl = URL.createObjectURL(file.raw);
        console.log(this.imageUrl)
        this.image=res.data
        console.log(this.image)
      },


      getList(page, size) {
        var params = {
          page: page,
          size: size,
        }
        // 得到所有用户的接口
        getEnngineerList(params).then(res => {
          this.list = res.data
          this.count = res.count
          this.listQuery.page=page
          this.listQuery.size=size
        })
          .catch(err => {
          })
      }
    }
  }
</script>
<style>
  .avatar-uploader .el-upload {
    border: 1px dashed #d9d9d9;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
  }
  .avatar-uploader .el-upload:hover {
    border-color: #409EFF;
  }
  .avatar-uploader-icon {
    font-size: 28px;
    color: #8c939d;
    width: 178px;
    height: 178px;
    line-height: 178px;
    text-align: center;
  }
  .avatar {
    width: 178px;
    height: 178px;
    display: block;
  }

</style>

